<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@page import="org.springframework.data.domain.Page"%>
<style type="text/css">
body {
	margin: 0 auto;
	text-align: center;
}

.yangshi {
	width: 80%;
	border: 1px solid #003;
	margin: 0 auto;
}

/* grid.css */
.container {
	width: 1150px;
	margin: 0 auto;
}

.showgrid {
	background: url(src/grid.png);
}

.column,.span-1,.span-2,.span-3,.span-4,.span-5,.span-6,.span-7,.span-8,.span-9,.span-10,.span-11,.span-12,.span-13,.span-14,.span-15,.span-16,.span-17,.span-18,.span-19,.span-20,.span-21,.span-22,.span-23,.span-24
	{
	float: left;
	margin-right: 10px;
}

.last {
	margin-right: 0;
}

.span-1 {
	width: 30px;
}

.span-2 {
	width: 70px;
}

.span-3 {
	width: 110px;
}

.span-4 {
	width: 150px;
}

.span-5 {
	width: 190px;
}

.span-6 {
	width: 230px;
}

.span-7 {
	width: 270px;
}

.span-8 {
	width: 310px;
}

.span-9 {
	width: 350px;
}

.span-10 {
	width: 390px;
}

.span-11 {
	width: 430px;
}

.span-12 {
	width: 470px;
}

.span-13 {
	width: 510px;
}

.span-14 {
	width: 550px;
}

.span-15 {
	width: 590px;
}

.span-16 {
	width: 630px;
}

.span-17 {
	width: 670px;
}

.span-18 {
	width: 710px;
}

.span-19 {
	width: 750px;
}

.span-20 {
	width: 790px;
}

.span-21 {
	width: 830px;
}

.span-22 {
	width: 870px;
}

.span-23 {
	width: 910px;
}

.span-24 {
	width: 1850px;
	margin-right: 0;
}
</style>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>查看压缩机维修报表</title>
<script>
function reset(){
	document.getElementById('datepicker2').value = formatDate(new Date());
	document.getElementById("datepicker2").value = "";
	document.getElementByName("customerName").value = "";
}

function jumpPage(pageNumber){
	document.getElementById('pageNumber').value = pageNumber;
}
</script>
<script>
$(function() {
	$("#datepicker1").datepicker({
		dateFormat : 'yy-mm-dd',
		beforeShow : function(input, inst) {
			inst.dpDiv.css({
				marginTop : -input.offsetHeight + 'px',
				marginLeft : input.offsetWidth + 5 + 'px'
			});
		}
	});
});


$(function() {
	$("#datepicker2").datepicker({
		dateFormat : 'yy-mm-dd',
		beforeShow : function(input, inst) {
			inst.dpDiv.css({
				marginTop : -input.offsetHeight + 'px',
				marginLeft : input.offsetWidth + 5 + 'px'
			});
		}
	});
});

$(document).ready(function() {
	//聚焦第一个输入框
	$("#customerName").focus();
	//为inputForm注册validate函数
	$("#inputForm").validate({
		rules: {
			customerName: "required"
		}
	});
});

$(document).ready(function() {
	$("#message").fadeOut(5000);
	$("#errormessage").fadeOut(5000);
});

</script>
</head>

<body>
	<c:if test="${not empty message}">
		<div id="message" class="success">${message}</div>
	</c:if>
	<c:if test="${not empty errormessage}">
		<div id="errormessage" class="error">${errormessage}</div>
	</c:if>

	<form:form id="inputForm" modelAttribute="search"
		action="${ctx}/report/comp/search" method="post">
		<fieldset class="prepend-top">
			<legend>压缩机报表查询</legend>
			<div>
				<label for="userName" class="field">安排人员:</label> <select
					style="width: 300px" id="userName" name="userName" size="1">
					<c:forEach var="user" items="${users}">
						<option value="${user.name}"
							<c:if test="${search.userName == user.name }">selected="selected"
						</c:if>>${user.name}</option>
					</c:forEach>
				</select>
			</div>
			<div>
				<label for="customerName" class="field">客户名称:</label> <select
					style="width: 300px" id="customerName" name="customerName" size="1">
					<option value="allCustomers"
						<c:if test="${search.customerName == 'allCustomers' }">selected="selected"
						</c:if>>全部客户</option>
					<c:forEach var="customer" items="${customers}">
						<option value="${customer.name}"
							<c:if test="${search.customerName == customer.name }">selected="selected"
						</c:if>>${customer.name}</option>
					</c:forEach>
				</select>
			</div>
			<input type="text" style="display: none;" id="pageNumber"
				name="pageNumber" size="40" value="${search.pageNumber}" />
			与"更新时间"相比较：
			<div>
				<label for="startDate" class="field">起始日期:</label> <input
					type="text" id="datepicker1" name="startDate" size="40"
					value="<bean:write format="yyyy-MM-dd" name="search" property="startDate"/>" />
				格式:yyyy-MM-dd
			</div>
			<div>
				<label for="endDate" class="field">截止日期:</label> <input type="text"
					id="datepicker2" name="endDate" size="40"
					value="<bean:write format="yyyy-MM-dd" name="search" property="endDate"/>" />
				格式:yyyy-MM-dd
			</div>
		</fieldset>
		<div>
			<input id="submit" onclick="jumpPage('research')"
				style="margin-left: 450px; text-align: center; width: 120px; height: 30px"
				type="submit" value="查    询" />&nbsp; <input id="reset"
				style="text-align: center; width: 120px; height: 30px" type="reset"
				value="重    置" onclick="reset()" />
		</div>
		<br>
		<shiro:hasPermission name="compump:edit">
			<h4>
				<a href="create">创建压缩机维修记录</a>
			</h4>
		</shiro:hasPermission>
		<shiro:hasPermission name="report:superedit"> <a  href="exportAllExcel">导出全部压缩机维修记录</a></shiro:hasPermission>
		<c:if test="${pages.totalElements > 0}">
			<h3 class="prepend-top">压缩机维修报表查询结果</h3>
			<h5 align="right">共${pages.totalElements}条记录|共${pages.totalPages}页|当前${pages.number+1}页|每页${pages.size}条|</h5>
			<div align="right">
				<h4><a  href="exportExcel">导出搜索结果至Excel表格</a></h4>
				<input id="firstone"
					<c:if test="${pages.firstPage}">disabled="disabled"</c:if>
					class="button" type="submit" onclick="jumpPage(0)" value="首页" />&nbsp;
				| <input id="preone"
					<c:if test='<%=!((Page)request.getAttribute("pages")).hasPreviousPage() %>'>disabled="disabled"</c:if>
					class="button" type="submit"
					onclick="jumpPage(${pages.number - 1})" value="上页" />&nbsp; | <input
					id="nextone"
					<c:if test='<%=!((Page)request.getAttribute("pages")).hasNextPage() %>'>disabled="disabled"</c:if>
					class="button" type="submit"
					onclick="jumpPage(${pages.number + 1})" value="下页" />&nbsp; | <input
					id="preone"
					<c:if test='${pages.lastPage}'>disabled="disabled"</c:if>
					class="button" type="submit"
					onclick="jumpPage(${pages.totalPages -1})" value="尾页" />&nbsp;
			</div>

			<table id="contentComPumpTable">
				<tr>
					<th align="center">维修ID</th>
					<th align="center">重点说明</th>
					<th align="center">客户名称</th>
					<th width="8%" align="center">S/N</th>
					<th width="7%" align="center">安排人员</th>
					<th align="center">客户订单号</th>
					<th align="center">维修单号</th>
					<th align="center">预计完成时间</th>
					<th align="center">入库</th>
					<th align="center">检测</th>
					<th align="center">试运行</th>
					<th align="center">检漏</th>
					<th align="center">测试</th>
					<th align="center">维修</th>
					<th align="center">再测试</th>
					<th align="center">完修包装</th>
					<th align="center">装箱</th>
					<th align="center">出库</th>
					<th align="center">备注</th>
					<th align="center">更新时间</th>
					<!-- <th align="center">更新人员</th>  -->
					<shiro:hasPermission name="compump:edit">
						<th width="10%" align="center">操作</th>
					</shiro:hasPermission>
				</tr>
				<c:forEach items="${reports}" var="report">
					<tr>
						<td>${report.reportId}</td>
						<td>${report.keyComment}</td>
						<td>${report.customerName}</td>
						<td>${report.SN}</td>
						<td>${report.assignedUser}</td>
						<td>${report.customerOrderNumber}</td>
						<td>${report.maintanceNumber}</td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="scheduleFinish" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="inputRepository" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="validation" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="tryRunning" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="leak" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="test" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="maintance" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="mtest" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="finishPackage" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="packages" /></td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="outputRepository" /></td>
						<td>${report.comments}</td>
						<td><bean:write format="yyyy-MM-dd" name="report"
								property="updateTime" /></td>
						<!-- <td>${report.updateByPersion}</td>  -->
						<td><shiro:hasPermission name="compump:edit">
								<a href="update/${report.id}" id="editLink-${report.id}">修改</a>
							</shiro:hasPermission> <shiro:hasPermission name="compump:delete">
								<a href="delete/${report.id}">删除</a>
							</shiro:hasPermission></td>
					</tr>
				</c:forEach>
			</table>


			<c:if test="${not empty pages}">
				<div align="right">
					<input id="firstone"
						<c:if test="${pages.firstPage}">disabled="disabled"</c:if>
						class="button" type="submit" onclick="jumpPage(0)" value="首页" />&nbsp;
					| <input id="preone"
						<c:if test='<%=!((Page)request.getAttribute("pages")).hasPreviousPage() %>'>disabled="disabled"</c:if>
						class="button" type="submit"
						onclick="jumpPage(${pages.number - 1})" value="上页" />&nbsp; | <input
						id="nextone"
						<c:if test='<%=!((Page)request.getAttribute("pages")).hasNextPage() %>'>disabled="disabled"</c:if>
						class="button" type="submit"
						onclick="jumpPage(${pages.number + 1})" value="下页" />&nbsp; | <input
						id="preone"
						<c:if test='${pages.lastPage}'>disabled="disabled"</c:if>
						class="button" type="submit"
						onclick="jumpPage(${pages.totalPages -1})" value="尾页" />&nbsp;
				</div>
			</c:if>
		</c:if>
	</form:form>
</body>
</html>
